/*
 	Software Author: Mike Moore
 	Vectrics Flashrecruit
 	Open source job board and applicant tracking system.  Built with enterprise Java.
 	GPL License applies to this source code.
 */
package org.vectrics.struts;

import java.util.Enumeration;
import java.util.Properties;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletRequestWrapper;

public class VectricsHttpServletRequest extends HttpServletRequestWrapper {
	private Properties parameters = new Properties();
	private String name = null;
	
	public VectricsHttpServletRequest(String name, Request originalRequest, Properties parameters) {
		super(originalRequest.getHttpRequest());
		this.setParameters(parameters);
		this.name = name;
	}
	
	public void setParameters(Properties parameters) {
		this.parameters.putAll(parameters);
	}
	
	public String getParameter(String name) {
		if (this.parameters.containsKey(name)) {
			return(this.parameters.getProperty(name));
		} else {
			return(super.getParameter(name));
		}
	}
	
	public Enumeration getParameterNames() {
        return new ParameterNamesEnumeration(parameters, super.getParameterNames());
    }
	
	public String toString() {
		return("VectricsHttpServletRequest:" + this.name);
	}
	
}
